<script setup lang="ts">
import { onLaunch, onHide, onUnload } from '@dcloudio/uni-app'
import store from '../src/store/index'
import '@/uni.scss'
import '@/static/css/custom.scss'
import '@/static/icon/iconfont.css'
import { getBrowser } from '@/utils/tools'
import bus from '@/utils/bus'
import { getUserInfo } from '@/api/login/index'

onLaunch((options: any) => {
  const sys = uni.getSystemInfoSync()
  // eruda.init();
  // const vConsole = new VConsole();
  store.commit('setSafeAreaBottom', sys.safeAreaInsets.bottom)

  const browser = getBrowser()
  store.commit('app/SET_BROWSER', browser)
  if (options.query.empi && JSON.stringify(options.query) != '{}') {
    store.commit('SET_ISNOTICE', true)
  }

  // store.commit('app/IM_INIT', {
  //   imAccid: '10001',
  //   imToken: '123456'
  // })
  // const userinfo = uni.getStorageSync('userInfo')
  // if (userinfo) {
  //   store.commit('app/IM_INIT', JSON.parse(userinfo))
  //   bus.emit('im')
  // }
})
onUnload(() => {
  store.dispatch('app/IM_DISCONNECT')
  store.dispatch('app/IM_DESTROY')
})

onHide(() => {
  store.commit('im/VIDEO_STOP')
  bus.emit('im_video_stop_paly')
  bus.emit('im_video_stop_record')
})
</script>
<style lang="scss">
@import 'uview-plus/index.scss';
@import '@/static/icon/iconfont.css';
view,
div {
  box-sizing: border-box;
}
page {
  background-color: #f3f7f8;
}
.uni-toast {
  padding: 0 30rpx;
}
button::after {
  border: none;
}
body,
html {
  overflow-x: hidden !important;
}
body::-webkit-scrollbar {
  display: none;
}
</style>
